Skip to content

Conversation

@NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Jun 25, 2025

followup to: #64

Key changes:

  • tell vitest to not forward its env to our invoked ember-cli / test commands
  • add babel-plugin-debug-macros for @glimmer/env for DEBUG support (only for the dev/test babel.config)
  • in the tests/index.html, enable the embroider-macros sync of isTesting via importing @embroider/macros/src/vendor/embroider-macros-test-support

"c8": "^7.11.3",
"ember-cli": "github:ember-cli/ember-cli#master",
"execa": "^9.5.2",
"execa": "^9.6.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be PR'd separately

addonDir = join(tmpDir, addonName);
await execa({
cwd: tmpDir,
extendEnv: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extendEnv is noise in this PR without an accompanying env: {} to set the env to empty

@mkszepp
Copy link
Contributor

mkszepp commented Dec 23, 2025

Would be nice to get this PR

In ember-basic-dropdown i have isTesting() in use, which isn't working right now without adding a workaround in test-helpers start() function

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/add-build-mode-tests branch from 8a895fd to da5827f Compare December 23, 2025 21:28
@NullVoxPopuli NullVoxPopuli changed the title Add build mode tests Add build mode tests (ensuring isDevelopingApp and isTesting are appropriately true when they need to be (as well as assert-stripping)) Dec 23, 2025
@mkszepp
Copy link
Contributor

mkszepp commented Jan 6, 2026

@NullVoxPopuli the fix of this branch works only partially...

I have an issue found out with ember-power-select and ember-basic-dropdown.
The ember-basic-dropdown addon has two isTesting() points (see here, this is the more critical point, when it stays false while testing).

When the ember-power-select is using the workaround from this branch, isTesting() is inside the ember-power-select addon true in test, but in ember-basic-dropdown code parts it's always false, which is not expected.

If you run this in ember app test (like ember-power-select docs), isTesting() is true, which is expected.

If you want test this issue, you can do this with following steps.

  1. Download ember-power-select (https://github.com/cibernox/ember-power-select)
  2. Run pnpm i
  3. Insert a console.log(isTesting()); in node_modules/ember-basic-dropdown/dist/components/basic-dropdown.js
  4. Run pnpm test on root or pnpm start with http://localhost:4200/tests

The isTesting() is always false and so all tests will normally fail. I have only added a workaround in eps, by setting destination (https://github.com/cibernox/ember-power-select/blob/master/tests/test-helper.ts#L51-L54, normaly this should not be needed)

@mkszepp
Copy link
Contributor

mkszepp commented Jan 17, 2026

Today i have again debugged the issue from power select / basic dropdown.

I have moved macro to peerDep in ember-basic-dropdown, but this hasn't solved the issue...

The only way to get inside basic dropdown isTesting() to true is to use import { isTesting } from '@embroider/macros/src/addon/runtime'; instead import { isTesting } from '@embroider/macros'; in basic dropdown addon.

Inside tests/test-helper.ts there is possible to take import { getGlobalConfig } from '@embroider/macros'; instead import { getGlobalConfig } from '@embroider/macros/src/addon/runtime'; (helps to reduce disable ts errors).

Maybe the best and clean way will be, that addon's which are using isTesting() (like ember-basic-dropdown in my case) should provide an option to set isTesting; true... something like setConfig({ isTesting: true }) (no hidden/magic embroider logic inside addon)

@NullVoxPopuli
Copy link
Contributor Author

what happens if you remove @embroider/macros entirely from the library? I wonder if you're having a bad peerdep / dep graph situation?

@mkszepp
Copy link
Contributor

mkszepp commented Jan 17, 2026

what happens if you remove @embroider/macros entirely from the library? I wonder if you're having a bad peerdep / dep graph situation?

tried locally with an patch, removing in ember-basic-dropdown the @embroider/macros... but it doesn't make a difference... same issue

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/add-build-mode-tests branch from d8c6aa6 to 2128af4 Compare January 17, 2026 17:18
@NullVoxPopuli
Copy link
Contributor Author

with a patch

what happens when you cd into ember-basic-dorpdown and then run npx y-which @embroider/macros?

@mkszepp
Copy link
Contributor

mkszepp commented Jan 17, 2026

npx y-which @embroider/macros

npx y-which @embroider/macros

  Node resolves @embroider/macros 
       to   ~/projects/github-master/ember-power-select/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@embroider/macros/src/index.js
       which is @ 1.19.6

     from   ember-basic-dropdown @ 8.11.0 
       at   ~/projects/github-master/ember-power-select/node_modules/.pnpm/ember-basic-dropdown@https+++codeload.github.com+cibernox+ember-basic-dropdown+tar.gz+f_cefe780ebb12e25c8fa2a0c6321373d8/node_modules/ember-basic-dropdown

@NullVoxPopuli
Copy link
Contributor Author

I would expect macros to not return a result, if you're testing in a full app, fwiw -- this leads me to believe a potential peer issue - maybe injected deps are needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants